package com.econ.powercloud.ems.common.enums;

/**
 * @Author : zjf
 * @Description : 诊断预警的排序字段
 * @Date : 2022/12/2 14:21
 * @Modified by : zjf
 */
public enum WarnSortFieldType implements EnumMethod{

    //累计预警次数
    WARN_TOTAL_NUM(1, "累计预警次数"),
    //当日预警点号数量
    WARN_TODAY_PID_NUM(2, "当日预警点号数量"),
    //当日预警次数
    WARN_TODAY_NUM(3, "当日预警次数")
    ;

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    WarnSortFieldType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static String getDescFromCode(int code){
        for(WarnSortFieldType type: WarnSortFieldType.values()){
            if(type.getCode() == code){
                return type.getDesc();
            }
        }
        return null;
    }
}
